package com.util;

/**
 * Created by wlc on 2018/5/17.
 */
public class PermissionUtil {
    public static boolean isQMRead(String permission){
        String QMpermission = permission.split("")[0];
        switch (QMpermission){
            case "F":return true;
            case "E":return true;
            case "D":return true;
            case "C":return true;
            case "B":return true;
            case "A":return true;
            case "9":return true;
            case "8":return true;
            case "7":return false;
            case "6":return false;
            case "5":return false;
            case "4":return false;
            case "3":return false;
            case "2":return false;
            case "1":return false;
            case "0":return false;
            default:return false;
        }
    }

    public static boolean isQMWrite(String permission){
        String QMpermission = permission.split("")[0];
        switch (QMpermission){
            case "F":return true;
            case "E":return true;
            case "D":return true;
            case "C":return true;
            case "B":return false;
            case "A":return false;
            case "9":return false;
            case "8":return false;
            case "7":return true;
            case "6":return true;
            case "5":return true;
            case "4":return true;
            case "3":return false;
            case "2":return false;
            case "1":return false;
            case "0":return false;
            default:return false;
        }
    }

    public static boolean isExperimentRead(String permission){
        String ExperimentPermission = permission.split("")[3];
        switch (ExperimentPermission){
            case "F":return true;
            case "E":return true;
            case "D":return true;
            case "C":return true;
            case "B":return true;
            case "A":return true;
            case "9":return true;
            case "8":return true;
            case "7":return false;
            case "6":return false;
            case "5":return false;
            case "4":return false;
            case "3":return false;
            case "2":return false;
            case "1":return false;
            case "0":return false;
            default:return false;
        }
    }

    public static boolean isExperimentWrite(String permission){
        String ExperimentPermission = permission.split("")[3];
        switch (ExperimentPermission){
            case "F":return true;
            case "E":return true;
            case "D":return true;
            case "C":return true;
            case "B":return false;
            case "A":return false;
            case "9":return false;
            case "8":return false;
            case "7":return true;
            case "6":return true;
            case "5":return true;
            case "4":return true;
            case "3":return false;
            case "2":return false;
            case "1":return false;
            case "0":return false;
            default:return false;
        }
    }

    public static boolean isFOLLOWUPRead(String permission){
        String FOLLOWUPpermission = permission.split("")[10];
        switch (FOLLOWUPpermission){
            case "F":return true;
            case "E":return true;
            case "D":return true;
            case "C":return true;
            case "B":return true;
            case "A":return true;
            case "9":return true;
            case "8":return true;
            case "7":return false;
            case "6":return false;
            case "5":return false;
            case "4":return false;
            case "3":return false;
            case "2":return false;
            case "1":return false;
            case "0":return false;
            default:return false;
        }
    }

    public static boolean isFOLLOWUPWrite(String permission){
        String FOLLOWUPpermission = permission.split("")[10];
        switch (FOLLOWUPpermission){
            case "F":return true;
            case "E":return true;
            case "D":return true;
            case "C":return true;
            case "B":return false;
            case "A":return false;
            case "9":return false;
            case "8":return false;
            case "7":return true;
            case "6":return true;
            case "5":return true;
            case "4":return true;
            case "3":return false;
            case "2":return false;
            case "1":return false;
            case "0":return false;
            default:return false;
        }
    }

    public static boolean isDATASETDownload(String permission) {
        String DATASETpermission = permission.split("")[5];
        switch (DATASETpermission) {
            case "F":
                return true;
            case "E":
                return false;
            case "D":
                return false;
            case "C":
                return false;
            case "B":
                return false;
            case "A":
                return false;
            case "9":
                return false;
            case "8":
                return false;
            case "7":
                return false;
            case "6":
                return false;
            case "5":
                return false;
            case "4":
                return false;
            case "3":
                return false;
            case "2":
                return false;
            case "1":
                return false;
            case "0":
                return false;
            default:
                return false;
        }
    }

    public static boolean isOnlinCoding(String permission) {
        String FOLLOWUPpermission = permission.split("")[10];
        switch (FOLLOWUPpermission) {
            case "F":
                return true;
            case "E":
                return false;
            case "D":
                return false;
            case "C":
                return false;
            case "B":
                return false;
            case "A":
                return false;
            case "9":
                return false;
            case "8":
                return false;
            case "7":
                return false;
            case "6":
                return false;
            case "5":
                return false;
            case "4":
                return false;
            case "3":
                return false;
            case "2":
                return false;
            case "1":
                return false;
            case "0":
                return false;
            default:
                return false;
        }
    }
}
